Imports System
Imports System.Data
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports BlazeApps.Library.WebServices


<WebService(Namespace:="BlazeKBWebServices")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class BlazeKBSVC
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function GetSearchResults(ByVal SearchString As String) As DataSet
        Dim Results As New ServiceItems

        Return Results.GetPageResults(BuildWhereClaue(SearchString), BuildItemTypeClause)
    End Function

    <WebMethod()> _
    Public Function GetPageDetails(ByVal PageGuidID As String) As DataSet
        Dim Results As New ServiceItems

        Return Results.GetPageDetails(New Guid(PageGuidID))
    End Function

    <WebMethod()> _
    Public Function GetViewerDetails(ByVal PageGuidID As String) As DataSet
        Dim Results As New ServiceItems

        Return Results.GetViewerDetails(New Guid(PageGuidID))
    End Function

    Private Function BuildWhereClaue(ByVal SearchString As String) As String
        Return String.Format("(title like '%{0}%' OR summary like '%{0}%' OR body like '%{0}%')", SearchString)
    End Function

    Private Function BuildItemTypeClause() As String
        Return String.Format("1,2,3,4,5,6,7")
    End Function

End Class
